package com.qxzn.module.home.activity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import com.qxzn.app.page.BaseActivity;
import com.qxzn.app.page.view.CustomItemView;
import com.qxzn.app.util.AppUtil;
import com.qxzn.app.util.Constant;
import com.qxzn.module.home.R;
import com.qxzn.module.home.R2;

import butterknife.BindView;

public class InputRemindContentActivity extends BaseActivity {

    @BindView(R2.id.civ_remind_content)
    CustomItemView civRemindContent;

    @Override
    protected int initLayout() {
        return R.layout.activity_input_remind_content;
    }

    @Override
    protected void initView() {
        civRemindContent.getIvRightView().setOnClickListener(this);
        iv_back.setOnClickListener(this);
    }

    @Override
    protected void iniTitleBar() {
        tv_title.setText("提醒内容");
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        if (!TextUtils.isEmpty(getIntent().getStringExtra(Constant.PutExtraKey.CONTENT))) {
            civRemindContent.setRightEditText(getIntent().getStringExtra(Constant.PutExtraKey.CONTENT));
        }
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.iv_back) {
            AppUtil.showLog(civRemindContent.getRightEditText());
            Intent intent = new Intent().putExtra(Constant.PutExtraKey.CONTENT, civRemindContent.getRightEditText());
            setResult(RESULT_OK, intent);
            finish();
        } else if (view.getId() == R.id.iv_right_view) {
            civRemindContent.setRightEditText(null);
        }
    }
}
